/**
 * ElectronExchanger Server Header File
 * 
 * File:        transaction.h
 * Brief:       BRIEF
 * Author:      Chen Kangbing
 * Email:       ckblau@outlook.com
 * Modified:    2020/09/09 08:52:03
 *
 */


#ifndef TRANSACTION_H
#define TRANSACTION_H

#ifdef __cplusplus
extern "C" {
#endif 


#include "protocol.h"

#include <sys/socket.h>
#include <arpa/inet.h>


typedef struct {
    int user_id;
    char session_id[50]; 
    char email[50];
    int expire_time;
    int timestamp;
} SessionDataTypeDef;

typedef int (*CmdCallbackFuncTypeDef)(SessionDataTypeDef *, ProtoPackTypeDef *, ProtoPackTypeDef *);

typedef struct {
    const char *cmd;
    const CmdCallbackFuncTypeDef callback;
    const int type;
} CmdCallbackDriverTypeDef;


void *transaction_main(void *parg);


#ifdef __cplusplus
}
#endif 

#endif
